<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>书籍借阅</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <link rel="stylesheet" href="${pageContext.request.contextPath }/dist/css/bootstrap.min.css" type="text/css"></link>
    <link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/ie10-viewport-bug-workaround.css" type="text/css"></link>
    <link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/justified-nav.css" type="text/css"></link>
    <script type="text/javascript" src="${pageContext.request.contextPath }/assets/js/ie-emulation-modes-warning.js"></script>
    
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/jquery.pagination.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.pagination.min.js"></script>
    
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }
        @media (max-width: 980px) {
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
    
    <script>
			$(function() {
				var cp=<%= request.getAttribute("currentPage")%>;
				var tp=<%= request.getAttribute("totalPage")%>;
				$("#pagination2").pagination({
					currentPage:cp,
					totalPage:tp,
					isShow: false,
					count: 6,
					prevPageText: "< 上一页",
					nextPageText: "下一页 >",
					callback: function(current) {
						/* 给后台传到了Currentpage */
						$("#CurrentPage").val(current);
						$("#form").submit();
					}
				});
			});
	</script>
    
</head>
<body>

<div class="container">

     <div class="masthead">
        <h3 class="text-muted">智能图书管理系统</h3>
        <nav>
          <ul class="nav nav-justified">
            <li ><a href="<%=request.getContextPath()%>/user/show">图书查询</a></li>
            <li class="active"><a href="<%=request.getContextPath()%>/user/back">借阅查询</a></li>
            <li><a href="<%=request.getContextPath()%>/user/showBackBook">图书归还或评分</a></li>
            <li><a href="<%=request.getContextPath()%>/user/showReserveBook">预约查询</a></li>
            <li><a href="<%=request.getContextPath()%>/user/person">个人信息</a></li>
            <li><a href="<%=request.getContextPath()%>/quit">退出登录</a></li>
          </ul>
        </nav>
      </div>
      
    <form id="form" class="form-inline definewidth m20"
		action="<%=request.getContextPath()%>/user/back" method="post">
		<input id="CurrentPage" type="hidden" name="currentPage" value="1" />
    </form>
    <h2 align="center">您的书籍借阅审批情况如下</h2>
   <table class="table table-bordered table-hover definewidth m10">
    <thead>
    <tr>
        <th>书籍名称</th>
        <th>书籍类别</th>
        <th>作者</th>
        <th>出版社</th>
        <th>版本</th>
        <th>申请时间</th>
        <th>借书状态</th>
    </tr>
    </thead>
    <c:forEach items="${page.list}" var="borrow">
    	<tr>
            <td>${borrow.bname}</td>
            <td>${borrow.sname}</td>
            <td>${borrow.author}</td>
            <td>${borrow.birth}</td>
            <td>${borrow.edition}</td>
           	<td><fmt:formatDate  value="${borrow.startTime}" type="time" pattern="yyyy-MM-dd HH:mm:ss"/></td>
            <td>
			    <c:if test="${borrow.status==0}"><button type="button" class="btn btn-default" disabled>待确认</button>></c:if>
				<c:if test="${borrow.status==1}"><button type="button" class="btn btn-success" disabled>审批通过</button></c:if>
				<c:if test="${borrow.status==2}"><button type="button" class="btn btn-primary" disabled>审批未通过</button></c:if>
				
			</td>
        </tr>	
    </c:forEach>
</table>

  <center>
		<div class="box">
			<div id="pagination2" class="page fl"></div>
		</div>
  </center>
 <!-- Site footer -->
      <footer class="footer" align="center">
        <p>YanJiaDou &copy; 2020 版权所有</p>
      </footer>
</div>
 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script type="text/javascript" src="${pageContext.request.contextPath }/assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
    
</html>